#pragma once

typedef struct _LIST_ENTRY32_T {
    DWORD32 Flink;
    DWORD32 Blink;
} LIST_ENTRY32_T, * PLIST_ENTRY32_T;

typedef struct _LIST_ENTRY64_T {
    DWORD64 Flink;
    DWORD64 Blink;
} LIST_ENTRY64_T, * PLIST_ENTRY64_T;

typedef struct _ANSI_STRING32_T {
    USHORT Length;
    USHORT MaximumLength;
    DWORD32 Buffer;
} ANSI_STRING32_T, * PANSI_STRING32_T;

typedef struct _ANSI_STRING64_T {
    USHORT Length;
    USHORT MaximumLength;
    DWORD64 Buffer;
} ANSI_STRING64_T, * PANSI_STRING64_T;

typedef struct _UNICODE_STRING32_T {
    USHORT Length;
    USHORT MaximumLength;
    DWORD32 Buffer;
} UNICODE_STRING32_T, * PUNICODE_STRING32_T;

typedef struct _UNICODE_STRING64_T {
    USHORT Length;
    USHORT MaximumLength;
    DWORD64 Buffer;
} UNICODE_STRING64_T, * PUNICODE_STRING64_T;

typedef struct _NT_TIB32_T {
    DWORD32 ExceptionList;
    DWORD32 StackBase;
    DWORD32 StackLimit;
    DWORD32 SubSystemTib;
    DWORD32 FiberData;
    DWORD32 ArbitraryUserPointer;
    DWORD32 Self;
} NT_TIB32_T, * PNT_TIB32_T;

typedef struct _NT_TIB64_T {
    DWORD64 ExceptionList;
    DWORD64 StackBase;
    DWORD64 StackLimit;
    DWORD64 SubSystemTib;
    DWORD64 FiberData;
    DWORD64 ArbitraryUserPointer;
    DWORD64 Self;
} NT_TIB64_T, * PNT_TIB64_T;

typedef struct _CLIENT_ID32 {
    DWORD32 UniqueProcess;
    DWORD32 UniqueThread;
}CLIENT_ID32, * PCLIENT_ID32;

typedef struct _CLIENT_ID64 {
    DWORD64 UniqueProcess;
    DWORD64 UniqueThread;
}CLIENT_ID64, * PCLIENT_ID64;

typedef struct _TEB32 {
    NT_TIB32_T NtTib;
    DWORD32 EnvironmentPointer;
    CLIENT_ID32 ClientId;
    DWORD32 ActiveRpcHandle;
    DWORD32 ThreadLocalStoragePointer;
    DWORD32 ProcessEnvironmentBlock;
    DWORD LastErrorValue;
    DWORD CountOfOwnedCriticalSections;
    DWORD32 CsrClientThread;
    DWORD32 Win32ThreadInfo;
    DWORD User32Reserved[26];
}TEB32, * PTEB32;

typedef struct _TEB64 {
    NT_TIB64_T NtTib;
    DWORD64 EnvironmentPointer;
    CLIENT_ID64 ClientId;
    DWORD64 ActiveRpcHandle;
    DWORD64 ThreadLocalStoragePointer;
    DWORD64 ProcessEnvironmentBlock;
    DWORD LastErrorValue;
    DWORD CountOfOwnedCriticalSections;
    DWORD64 CsrClientThread;
    DWORD64 Win32ThreadInfo;
    DWORD User32Reserved[26];
}TEB64, * PTEB64;

typedef struct _PEB32 {
    union
    {
        struct
        {
            BYTE InheritedAddressSpace;
            BYTE ReadImageFileExecOptions;
            BYTE BeingDebugged;
            BYTE BitField;
        };
        DWORD32 dummy01;
    };
    DWORD32 Mutant;
    DWORD32 ImageBaseAddress;
    DWORD32 Ldr;
    DWORD32 ProcessParameters;
    DWORD32 SubSystemData;
    DWORD32 ProcessHeap;
    DWORD32 FastPebLock;
    DWORD32 AtlThunkSListPtr;
    DWORD32 IFEOKey;
    DWORD32 CrossProcessFlags;
    DWORD32 UserSharedInfoPtr;
    DWORD SystemReserved;
    DWORD AtlThunkSListPtr32;
    DWORD32 ApiSetMap;
    DWORD32 TlsExpansionCounter;
    DWORD32 TlsBitmap;
    DWORD TlsBitmapBits[2];
    DWORD32 ReadOnlySharedMemoryBase;
    DWORD32 HotpatchInformation;
    DWORD32 ReadOnlyStaticServerData;
    DWORD32 AnsiCodePageData;
    DWORD32 OemCodePageData;
    DWORD32 UnicodeCaseTableData;
    DWORD NumberOfProcessors;
    union
    {
        DWORD NtGlobalFlag;
        DWORD64 dummy02;
    };
    LARGE_INTEGER CriticalSectionTimeout;
    DWORD32 HeapSegmentReserve;
    DWORD32 HeapSegmentCommit;
    DWORD32 HeapDeCommitTotalFreeThreshold;
    DWORD32 HeapDeCommitFreeBlockThreshold;
    DWORD NumberOfHeaps;
    DWORD MaximumNumberOfHeaps;
    DWORD32 ProcessHeaps;
    DWORD32 GdiSharedHandleTable;
    DWORD32 ProcessStarterHelper;
    DWORD32 GdiDCAttributeList;
    DWORD32 LoaderLock;
    DWORD OSMajorVersion;
    DWORD OSMinorVersion;
    WORD OSBuildNumber;
    WORD OSCSDVersion;
    DWORD OSPlatformId;
    DWORD ImageSubsystem;
    DWORD ImageSubsystemMajorVersion;
    DWORD32 ImageSubsystemMinorVersion;
    DWORD32 ActiveProcessAffinityMask;
    DWORD32 GdiHandleBuffer[34];
    DWORD32 PostProcessInitRoutine;
    DWORD32 TlsExpansionBitmap;
    DWORD TlsExpansionBitmapBits[32];
    DWORD32 SessionId;
    ULARGE_INTEGER AppCompatFlags;
    ULARGE_INTEGER AppCompatFlagsUser;
    DWORD32 pShimData;
    DWORD32 AppCompatInfo;
    UNICODE_STRING32_T CSDVersion;
    DWORD32 ActivationContextData;
    DWORD32 ProcessAssemblyStorageMap;
    DWORD32 SystemDefaultActivationContextData;
    DWORD32 SystemAssemblyStorageMap;
    DWORD32 MinimumStackCommit;
    DWORD32 FlsCallback;
    LIST_ENTRY32_T FlsListHead;
    DWORD32 FlsBitmap;
    DWORD FlsBitmapBits[4];
    DWORD32 FlsHighIndex;
    DWORD32 WerRegistrationData;
    DWORD32 WerShipAssertPtr;
    DWORD32 pContextData;
    DWORD32 pImageHeaderHash;
    DWORD32 TracingFlags;
}PEB32, * PPEB32;

typedef struct _PEB64 {
    union
    {
        struct
        {
            BYTE InheritedAddressSpace;
            BYTE ReadImageFileExecOptions;
            BYTE BeingDebugged;
            BYTE BitField;
        };
        DWORD64 dummy01;
    };
    DWORD64 Mutant;
    DWORD64 ImageBaseAddress;
    DWORD64 Ldr;
    DWORD64 ProcessParameters;
    DWORD64 SubSystemData;
    DWORD64 ProcessHeap;
    DWORD64 FastPebLock;
    DWORD64 AtlThunkSListPtr;
    DWORD64 IFEOKey;
    DWORD64 CrossProcessFlags;
    DWORD64 UserSharedInfoPtr;
    DWORD SystemReserved;
    DWORD AtlThunkSListPtr32;
    DWORD64 ApiSetMap;
    DWORD64 TlsExpansionCounter;
    DWORD64 TlsBitmap;
    DWORD TlsBitmapBits[2];
    DWORD64 ReadOnlySharedMemoryBase;
    DWORD64 HotpatchInformation;
    DWORD64 ReadOnlyStaticServerData;
    DWORD64 AnsiCodePageData;
    DWORD64 OemCodePageData;
    DWORD64 UnicodeCaseTableData;
    DWORD NumberOfProcessors;
    union
    {
        DWORD NtGlobalFlag;
        DWORD32 dummy02;
    };
    LARGE_INTEGER CriticalSectionTimeout;
    DWORD64 HeapSegmentReserve;
    DWORD64 HeapSegmentCommit;
    DWORD64 HeapDeCommitTotalFreeThreshold;
    DWORD64 HeapDeCommitFreeBlockThreshold;
    DWORD NumberOfHeaps;
    DWORD MaximumNumberOfHeaps;
    DWORD64 ProcessHeaps;
    DWORD64 GdiSharedHandleTable;
    DWORD64 ProcessStarterHelper;
    DWORD64 GdiDCAttributeList;
    DWORD64 LoaderLock;
    DWORD OSMajorVersion;
    DWORD OSMinorVersion;
    WORD OSBuildNumber;
    WORD OSCSDVersion;
    DWORD OSPlatformId;
    DWORD ImageSubsystem;
    DWORD ImageSubsystemMajorVersion;
    DWORD64 ImageSubsystemMinorVersion;
    DWORD64 ActiveProcessAffinityMask;
    DWORD64 GdiHandleBuffer[30];
    DWORD64 PostProcessInitRoutine;
    DWORD64 TlsExpansionBitmap;
    DWORD TlsExpansionBitmapBits[32];
    DWORD64 SessionId;
    ULARGE_INTEGER AppCompatFlags;
    ULARGE_INTEGER AppCompatFlagsUser;
    DWORD64 pShimData;
    DWORD64 AppCompatInfo;
    UNICODE_STRING64_T CSDVersion;
    DWORD64 ActivationContextData;
    DWORD64 ProcessAssemblyStorageMap;
    DWORD64 SystemDefaultActivationContextData;
    DWORD64 SystemAssemblyStorageMap;
    DWORD64 MinimumStackCommit;
    DWORD64 FlsCallback;
    LIST_ENTRY64_T FlsListHead;
    DWORD64 FlsBitmap;
    DWORD FlsBitmapBits[4];
    DWORD64 FlsHighIndex;
    DWORD64 WerRegistrationData;
    DWORD64 WerShipAssertPtr;
    DWORD64 pContextData;
    DWORD64 pImageHeaderHash;
    DWORD64 TracingFlags;
}PEB64, * PPEB64;

typedef struct _LDR_DATA_TABLE_ENTRY32 {
    LIST_ENTRY32_T InLoadOrderLinks;
    LIST_ENTRY32_T InMemoryOrderLinks;
    LIST_ENTRY32_T InInitializationOrderLinks;
    DWORD32 DllBase;
    DWORD32 EntryPoint;
    union
    {
        DWORD SizeOfImage;
        DWORD32 dummy01;
    };
    UNICODE_STRING32_T FullDllName;
    UNICODE_STRING32_T BaseDllName;
    DWORD Flags;
    WORD LoadCount;
    WORD TlsIndex;
    union
    {
        LIST_ENTRY32_T HashLinks;
        struct
        {
            DWORD32 SectionPointer;
            DWORD32 CheckSum;
        };
    };
    union
    {
        DWORD32 LoadedImports;
        DWORD TimeDateStamp;
    };
    DWORD32 EntryPointActivationContext;
    DWORD32 PatchInformation;
    LIST_ENTRY32_T ForwarderLinks;
    LIST_ENTRY32_T ServiceTagLinks;
    LIST_ENTRY32_T StaticLinks;
    DWORD32 ContextInformation;
    DWORD32 OriginalBase;
    LARGE_INTEGER LoadTime;
}LDR_DATA_TABLE_ENTRY32, * PLDR_DATA_TABLE_ENTRY32;

typedef struct _LDR_DATA_TABLE_ENTRY64 {
    LIST_ENTRY64_T InLoadOrderLinks;
    LIST_ENTRY64_T InMemoryOrderLinks;
    LIST_ENTRY64_T InInitializationOrderLinks;
    DWORD64 DllBase;
    DWORD64 EntryPoint;
    union
    {
        DWORD SizeOfImage;
        DWORD64 dummy01;
    };
    UNICODE_STRING64_T FullDllName;
    UNICODE_STRING64_T BaseDllName;
    DWORD Flags;
    WORD LoadCount;
    WORD TlsIndex;
    union
    {
        LIST_ENTRY64_T HashLinks;
        struct
        {
            DWORD64 SectionPointer;
            DWORD64 CheckSum;
        };
    };
    union
    {
        DWORD64 LoadedImports;
        DWORD TimeDateStamp;
    };
    DWORD64 EntryPointActivationContext;
    DWORD64 PatchInformation;
    LIST_ENTRY64_T ForwarderLinks;
    LIST_ENTRY64_T ServiceTagLinks;
    LIST_ENTRY64_T StaticLinks;
    DWORD64 ContextInformation;
    DWORD64 OriginalBase;
    LARGE_INTEGER LoadTime;
}LDR_DATA_TABLE_ENTRY64, * PLDR_DATA_TABLE_ENTRY64;

typedef struct _PEB_LDR_DATA32 {
    DWORD Length;
    DWORD Initialized;
    DWORD32 SsHandle;
    LIST_ENTRY32_T InLoadOrderModuleList;
    LIST_ENTRY32_T InMemoryOrderModuleList;
    LIST_ENTRY32_T InInitializationOrderModuleList;
    DWORD32 EntryInProgress;
    DWORD ShutdownInProgress;
    DWORD32 ShutdownThreadId;
}PEB_LDR_DATA32, * PPEB_LDR_DATA32;

typedef struct _PEB_LDR_DATA64 {
    DWORD Length;
    DWORD Initialized;
    DWORD64 SsHandle;
    LIST_ENTRY64_T InLoadOrderModuleList;
    LIST_ENTRY64_T InMemoryOrderModuleList;
    LIST_ENTRY64_T InInitializationOrderModuleList;
    DWORD64 EntryInProgress;
    DWORD ShutdownInProgress;
    DWORD64 ShutdownThreadId;
}PEB_LDR_DATA64, * PPEB_LDR_DATA64;
